import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "*",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "home",
    component: () => import("@/views/Home/index"),
    children: [
      {
        path: "",
        redirect: "list",
      },
      {
        path: "list",
        component: () => import("@/views/Home/List"),
      },
      {
        path: "sign",
        component: () => import("@/views/Home/Sign"),
      },
      {
        path: "time",
        component: () => import("@/views/Home/Time"),
      },
    ],
  },
];

const VueRouterPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch((err) => err);
};

const router = new VueRouter({
  mode: "hash",
  base: "/",
  routes,
});

export default router;
